<!--
 * @Author: your name
 * @Date: 2021-08-18 15:11:12
 * @LastEditTime: 2021-09-14 20:14:51
 * @LastEditors: your name
 * @Description: In User Settings Edit
 * @FilePath: \cscec-pms-admin-3\src\components\businessComponents\TreeInspection\index.vue
-->
<template>
  <!-- 实测实量检查项树搜索 -->
  <tree-search
    ref="treeSearch"
    v-bind="$attrs"
    is-all
    :init-expand-all="false"
    empty-description="暂无检查项信息"
    :replace-fields="{ children: 'children', title: 'name', key: 'id' }"
    :api="apiTree"
    :selected-keys.sync="selectedKeys"
    :select-options.sync="selectOptions"
    v-on="$listeners"
  />
</template>

<script>
import TreeSearch from '@/components/businessComponents/TreeSearch' // 树
import { tree } from '@/api/quality/reality' // api
export default {
    name:'TreeInspection',
    components: {
        TreeSearch,
    },
    computed: {
        // 树节点api
        apiTree() {
            return tree
        },
    },
    data() {
        return {
            selectedKeys: {},
            selectOptions: {},
        }
    },
    methods: {
        // 渲染列表
        getList() {
            return this.$refs.treeSearch.getList()
        }
    },
    watch: {
        selectedKeys(e) {
            this.$emit('update:selectedKeys', e)
        },
        selectOptions(e) {
            this.$emit('update:selectOptions', e)
        },
    },
}
</script>
